﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>会员收货地址修改页 - ${web.name}${web.additionalTitle!}</title>
    <link href="${root}/css/global.css" type="text/css" rel="stylesheet"/>
    <link href="${root}/css/layout.css" type="text/css" rel="stylesheet"/>
    <link href="${root}/css/member.css" type="text/css" rel="stylesheet"/>
    <link href="${root}/css/buy.css" type="text/css" rel="stylesheet"/>
    <link href="${root}/css/front.css" rel="stylesheet" type="text/css"/>
    <script src="${root}/js/jquery.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#baseForm").validate();
        });
        //获得城市
        function getResultCity(d) {
            $.post('findAllCity.htm', {"id": d},
                    function (data) {
                        if (data.success) {
                            $("#itemcity").html("");
                            var select = "<select name='cityId' onchange='getResultCountry(this.value)'>";
                            for (var i = 0; i < data.ids.length; i++) {
                                select += "<option value='" + data.ids[i] + "'>&nbsp;" + data.citys[i] + "&nbsp;</option>";
                            }
                            select += "</select>";
                            getResultCountry(data.ids[0]);
                            $("#itemcity").append(select);
                        }
                    }, "json");
        }
        //获得县、区
        function getResultCountry(a) {
            $.post('findAllCountry.htm', {"id": a},
                    function (data) {
                        if (data.success) {
                            $("#itemarea").html("");
                            var select = "<select name='countryId'>";
                            for (var i = 0; i < data.ids.length; i++) {
                                select += "<option value='" + data.ids[i] + "'>&nbsp;" + data.areas[i] + "&nbsp;</option>";
                            }
                            select += "</select>";
                            $("#itemarea").append(select);
                        }
                    }, "json");
        }
        function checkSubmit() {
            if ($("#tel").val() == '' && $("#phone").val() == '') {
                alert("手机跟电话至少有一项必填");
                return;
            }
            $("#baseForm").submit();
        }
    </script>
</head>
<body>
[#include "../include/header_top.html"/]
<div id="head">
    [#include "../include/header_search.html"/]
    [#include "../include/header_nav.html"/]
</div>
<div class="w960 mt10">
    [#include "member_nav.html"/]
    <div class="columnright">
        <h3>现在的收货地址</h3>
        <ul class="address">
            [#list list as address]
            <li
            [#if address.isDefault]class="current"[/#if]><s>${address_index+1}</s><span class="fr">
			 <a href="address_edit.htm?id=${address.id}" class="y44" target="_self">修改</a> |
             <a href="address_delete.htm?id=${address.id}" class="w44">删除|</a>
             <a href="address_default.htm?id=${address.id}">设为默认</a></span>
            ${address.username!},${address.province.name!},${address.city.name!},
            ${address.country.name!},${address.detailaddress!},${address.postCode!},${address.tel!}
            </li>
            [/#list]
        </ul>
        <h3>收货地址修改<span class="gray">（手机、固定电话选填一项，其余均为必填）</span></h3>

        <form action="address_update.htm" id="baseForm" name="addAddress" method="post">
            <table width="100%" border="0" cellspacing="2" cellpadding="0">
                <tr>
                    <td height="25" width="70" align="right" style="color:#333;">收货人：</td>
                    <td width="648"><input type="text" name="username" value="${bean.username!}" maxlength="20"
                                           class="address_input required"/></td>
                </tr>
                <tr>
                    <td height="25" align="right" style="color:#333;">性别：</td>
                    <td width="648"><input type="radio" name="gender" value="true" [#if bean.gender??] [#if
                        bean.gender==true] checked[/#if][/#if]/>男&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="gender" value="false" [#if bean.gender??] [#if bean.gender==false]
                        checked[/#if][/#if]/>女
                    </td>
                </tr>
                <tr>
                    <td height="25" align="right" style="color:#333;">所在地址：</td>
                    <td width="648">
                        <select id="provinceId" name="provinceId" onchange="getResultCity(this.value)">
                            [#list plist as province]
                            <option value="${province.id!}"
                            [#if bean.province??][#if
                            bean.province.id==province.id]selected[/#if][/#if]>${province.name!}</option>
                            [/#list]
                        </select>
               <span id="itemcity">  
                 <select name="cityId" id="cityId">
                     [#list clist as city]
                     <option value="${city.id!}"
                     [#if bean.city??][#if bean.city.id==city.id] selected [/#if][/#if]>${city.name!}</option>
                     [/#list]
                 </select>
             </span>
             <span id="itemarea">  
               <select name="countryId" id="countryId">
                   [#list alist as country]
                   <option value="${country.id!}"
                   [#if bean.country??][#if bean.country.id==country.id] selected [/#if][/#if]>${country.name!}</option>
                   [/#list]
               </select>
            </span>
                        <a target="_blank"
                           href="http://www.yihaodian.com/cms/view.do?topicId=13735&type=3">了解具体的配送范围 </a>
                    </td>
                </tr>
                <tr>
                    <td height="25" align="right" style="color:#333;">详细地址：</td>
                    <td width="648"><input type="text" name="detailaddress" value="${bean.detailaddress!}" size="50"
                                           maxlength="100" class="address_input required"/></td>
                </tr>
                <tr>
                    <td height="25" align="right" style="color:#333;">邮政编码：</td>
                    <td width="648"><input type="text" name="postCode" value="${bean.postCode!}" maxlength="15"
                                           class="address_input required"/></td>
                </tr>
                <tr>
                    <td height="25" align="right" style="color:#333;">手机：</td>
                    <td width="648"><input type="text" id="tel" name="tel" value="${bean.tel!}" maxlength="11"
                                           class="address_input digits"/>手机跟电话至少有一项必填
                    </td>
                </tr>
                <tr>
                    <td height="25" align="right" style="color:#333;">固定电话：</td>
                    <td width="648"><input type="text" id="areaCode" name="areaCode" value="${bean.areaCode!}" size="4"
                                           maxlength="4" class="digits"/>-
                        <input type="text" id="phone" name="phone" value="${bean.phone!}" size="14" maxlength="10"
                               class="digits"/>-
                        <input type="text" id="extNumber" name="extNumber" value="${bean.extNumber!}" size="6"
                               maxlength="6" class="digits"/>
                        区号(3到4位数字，可选)-电话号码(7到8位数字)-分机号(最多6位数字，可选)
                    </td>
                </tr>
                <tr>
                    <td height="25" align="right">&nbsp;</td>
                    <td width="648"><input type="checkbox" name="isDefault" [#if bean.isDefault==true]checked
                        value="true" [#else] value="true"[/#if]/>设为默认地址
                    </td>
                </tr>
                <tr>
                    <td height="25" align="right"><input type="hidden" name="id" value="${bean.id}"/></td>
                    <td width="648"><input type="button" value="保&nbsp;&nbsp;存 " onclick="checkSubmit();"/>&nbsp;&nbsp;
                        <input type="reset" value="重&nbsp;&nbsp;置"/></td>
                </tr>
            </table>
        </form>
    </div>
    <div class="clear"></div>
</div>
[#include "../include/footer.html"/]
</body>
</html>